package com.hzyc.springdata.jpa.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hzyc.springdata.jpa.dao.StudentRepository;
import com.hzyc.springdata.jpa.domain.Student;
import com.hzyc.springdata.jpa.service.IStudentService;

@Service
public class StudentServiceImpl implements IStudentService {

	@Resource
	private StudentRepository stuDao;

	/* (non-Javadoc)
	 * @see com.hzyc.springdata.jpa.service.impl.IStudentService#getStudent(int)
	 */
	@Override
	public Student getStudent(int id) {
		return stuDao.getOne(id);
	}

	/* (non-Javadoc)
	 * @see com.hzyc.springdata.jpa.service.impl.IStudentService#saveStudent(com.hzyc.springdata.jpa.domain.Student)
	 */
	@Override
	public Student saveStudent(Student stu) {
		return stuDao.saveAndFlush(stu);
	}
	
}
